﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Hisuntech.SystemFramework.Net.Json;
using am.Charts;

public partial class FundYield_SZPLZD_NowFundList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string a = "9b91eb3e-e784-4f6b-9082-dcefbfc72666";
        string url = "http://localhost:9162/FundYield.svc/GetNowFundList";

        DataSet ccc = JSONClient.PostData<string, DataSet>(url, a);
        this.now.DataSource = ccc;
        this.now.DataBind();

        string url1 = "http://localhost:9162/FundYield.svc/GetZhuHeSYL";

        double r1 = JSONClient.PostData<string, double>(url1, a);
        this.Label1.Text = r1.ToString();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        string a = "9b91eb3e-e784-4f6b-9082-dcefbfc72666";
        string url = "http://localhost:9162/FundYield.svc/GetHistoryFundList?zdid=" + a + "&startDay=2002-10-10&endDay=2010-05-05";

        DataSet ccc = JSONClient.GetData<DataSet>(url);
        this.history.DataSource = ccc;
        this.history.DataBind();

        BindChart(a);

    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        //string a = "0479f3de-4e32-4ff5-bd69-526c3fb6a4dd";
        //string url = "http://localhost:9162/FundYield.svc/jisuanOnejjForShenzhen";

        //int r = JSONClient.PostData<string, int>(url, a);
        string a = "9b91eb3e-e784-4f6b-9082-dcefbfc72666";
        string url = "http://localhost:9162/FundYield.svc/jisuanZhuHeForShenzhen";

        double r = JSONClient.PostData<string, double>(url, a);
        this.Label1.Text = r.ToString();
    }

    private void BindChart(string zdid)
    {
        string url = "http://localhost:9162/FundYield.svc/getRealShouyilv?zdid=" + zdid;

        DataSet ccc = JSONClient.GetData<DataSet>(url);
        //设置图形的长高
        LineChart1.Width = new Unit(800);
        LineChart1.Height = new Unit(400);

        //添加一个线条
        LineChartGraph lcg = new LineChartGraph();
        //这里是线条峰点的形状(正方形):实心圆,空心圆....
        //lcg.Bullet = LineChartBulletTypes.SquareOutline;
        //这里是线条的颜色
        //lcg.BulletColor = Color.Yellow;
        //向下面积的颜色
        //lcg.FillColor = Color.Yellow;
        ////向下面积的透明度
        //lcg.FillAlpha = Convert.ToByte(40);
        ////Y轴值在右边(默认在左边)
        //lcg.Axis = LineChartAxes.Right;

        lcg.DataSource = ccc;
        lcg.DataSeriesItemIDField = "fsrq";
        lcg.DataValueField = "shouyilv";
        lcg.Title = "收益率";
        LineChart1.Graphs.Add(lcg);

        LineChart1.DataSource = ccc;
        LineChart1.DataSeriesIDField = "fsrq";
        LineChart1.DataBind();
    }
}
